/*
 * @Author: zxc
 * @Date: 2020-08-02 12:26:44
 * @LastEditTime: 2020-08-02 12:34:13
 * @LastEditors: zxc
 * @Description: 击鼓传花
 */ 
import './queue'
const hotPotato = (list,num) => {
  const queue = new Queue();
  const elimitatedList = [];
  list.forEach(el => {
    queue.enqueue(el)
  })
  while(queue.size() > 1) {
    for(let i = 0; i< num; i++) {
      queue.enqueue(queue.dequeue())
    }
    elimitatedList.push(queue.dequeue())
  }
  return {
    eliminated:elimitatedList,
    winner:queue.dequeue()
  }
}